﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NIF.MobileActors.Core
{
    [Serializable]
    public class ActorProxy<T>
    {
        public ActorProxy(ActorBase<T> actor)
        {
            actorRef = actor;
        }

        public void Post(Action<T> action)
        {
            if (actorRef.Existed) return;
            actorRef.Post(action);
        }

        public void Activate()
        {
            if (actorRef.Existed) return;
            actorRef.Activate();
        }

        public void Deactivate()
        {
            if (actorRef.Existed) return;
            actorRef.Deactivate();
        }

        public ActorID ID
        {
            get { return actorRef.ID; }
        }

        public ActorBase<T> GetActor()
        {
            return actorRef;
        }

        private ActorBase<T> actorRef = null;
        
    }
}
